<!DOCTYPE html>
<title>Tests the calculation of negative auto margins of absolutely positioned element</title>
<link rel="help" href="https://drafts.csswg.org/css-position/#abspos-margins">
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1492323">
<link rel="author" href="mailto:xiaochengh@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
<style>
.cb {
  position: relative;
  width: 400px;
  height: 400px;
  outline: 1px dashed black;
}

.target {
  writing-mode: vertical-lr;
  position: absolute;
  background: green;
  width: calc(100% - 100px);
  height: calc(100% - 100px);
  inset: 100px;
  margin: auto;
}
</style>

<body onload="checkLayout('.target')">
  <div class="cb">
    <div class="target"
         data-expected-margin-top="-50" data-expected-margin-bottom="-50"
         data-expected-margin-left="0" data-expected-margin-right="-100"></div>
  </div>
</body>
